package com.cadre.common.utils.oldutil;

import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBookmark;

import java.util.LinkedHashMap;
import java.util.Map;

/* loaded from: XueliHandler.class */
public class XueliHandler implements CellHandler {
    @Override // com.tdqy.cadre.modular.profess.common.report.CellHandler
    public void setValue(XWPFParagraph paragraph, Map data) {
        XWPFRun run = paragraph.createRun();
        CTBookmark bookmark = paragraph.getCTP().getBookmarkStartArray(0);
        if (data.get(bookmark.getName()) != null) {
            String value = data.get(bookmark.getName()).toString().trim();
            if (RenmbReportHelper.isBreak(value)) {
                run.setFontSize(RenmbReportHelper.executeFontSize(value, initxuelixueweiConfig()));
                run.setText(value);
                return;
            }
            String[] values = RenmbReportHelper.splitstr(value);
            Map<Integer, Integer> tmap = initxuelixueweiSigleConfig();
            run.setFontSize(RenmbReportHelper.executeFontSize(values[0], tmap));
            run.setText(values[0]);
            run.addBreak();
            int fontsize2 = RenmbReportHelper.executeFontSize(values[1], tmap);
            XWPFRun run1 = paragraph.createRun();
            run1.setFontSize(fontsize2);
            run1.setText(values[1]);
        }
    }

    private static Map<Integer, Integer> initxuelixueweiSigleConfig() {
        Map<Integer, Integer> map = new LinkedHashMap<>();
        map.put(16, 14);
        map.put(18, 12);
        map.put(20, 11);
        map.put(22, 10);
        map.put(24, 9);
        map.put(28, 8);
        return map;
    }

    private static Map<Integer, Integer> initxuelixueweiConfig() {
        Map<Integer, Integer> map = new LinkedHashMap<>();
        map.put(32, 14);
        map.put(36, 12);
        map.put(42, 10);
        map.put(52, 8);
        return map;
    }
}
